//
//  DropDownButton.h
//  etionLib
//
//  Created by wu jingxing on 12-6-8.
//  Copyright (c) 2012年 GuangZhouXuanWu. All rights reserved.
//

#import <UIKit/UIKit.h>

@class CDropDownButton;

//#ifdef ETIONIPAD
//@interface CPopoverController : UIPopoverController
//{
//    CDropDownButton* m_btn;
//}
//
//@property(nonatomic,readonly) CDropDownButton* m_btn;
//
//@end
//#endif

@protocol CDropDownViewControllerDelegate <NSObject>

@property(nonatomic,weak) CDropDownButton *dropDownButton;

@end

@protocol CDropDownButtonDelegate<NSObject>

@optional
//#ifdef ETIONIPAD
-(BOOL)popoverControllerShouldDismissPopover:(CDropDownButton*)button popover:(UIPopoverController*)popoverController;
-(void)popoverControllerDidDismissPopover:(CDropDownButton*)button popover:(UIPopoverController*)popoverController;
-(void)popoverControllerWillShowPopover:(CDropDownButton*)button popover:(UIPopoverController*)popoverController;
-(BOOL)popoverControllerShouldDelayShowPopover:(CDropDownButton*)button popover:(UIPopoverController*)popoverController;
//#endif
-(void)dropDownButtonClick:(CDropDownButton*)button;

-(void)dropDownButtonReset:(CDropDownButton*)button;

@end

@interface CDropDownButton : UIButton
//#ifdef ETIONIPAD
<UIPopoverControllerDelegate,UIViewExtendDelegate>
//#endif

@property(nonatomic,assign) CGFloat rightSpace;
@property(nonatomic,assign) CGFloat leftSpace;
@property(nonatomic,assign) id<CDropDownButtonDelegate> delegate;
@property(nonatomic,retain) NSString *title;
@property(nonatomic,retain) UIImage *backgroundImage; //default is ddbtn_bg_normal.png
@property(nonatomic,retain) UIFont* font;
@property(nonatomic,retain) UIColor* fontColor;

//#ifdef ETIONIPAD
@property(nonatomic,retain) UIPopoverController* popver;
@property(nonatomic,assign) UIPopoverArrowDirection arrowdirection;
//#endif

-(id)initWithFrame:(CGRect)frame vcl:(UIViewController*)vcl;

//#ifdef ETIONIPAD
-(void)setPopoverViewController:(UIViewController*)vcl;
-(void)presentPopover;
-(void)dismissPopover;
//#endif

-(void)dropDown;

-(void)reset;

@end
